package com.hclc.util.condition;

import java.util.Objects;
import java.util.function.Consumer;

/**
 * @ClassName AssembleUtil
 * @Author: yurj
 * @Mail：1638234804@qq.com
 * @Date: Create in 21:10 2020-3-27
 * @version: 1.0
 */
public class AssembleUtil<T> {
    public AssembleUtil() {
    }
    private T t;

    public static <T> AssembleUtil<T> build() {
        return new AssembleUtil<>();
    }

    /**
     * 如果为true则消费一段函数
     * @param expression
	 * @param after
     * @return void
     * @author yurj
     * @mail 1638234804@qq.com
     * @version 1.0
     * @date 2020-3-28 10:15
     */

    public void isTrueThenConsumer(boolean expression, Consumer<? super T> after) {
        Objects.requireNonNull(after);
        if (expression) {
            after.accept(t);
        }
    }

}
